<%@ page contentType="text/html;charset=ISO-8859-1" language="java" %>
<%@ page import="java.io.StringWriter, java.io.PrintWriter" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:if test="${not empty requestScope['org.apache.struts.action.EXCEPTION']}">
  <h3><fmt:message key="errors.global.header"/></h3>
  <c:catch var="exception">
  	<c:set var="message" value="${requestScope['org.apache.struts.action.EXCEPTION'].message}"/>
  </c:catch>
  <c:if test="${not empty exception}">
    <c:catch var="exception">
  		<c:set var="message" value="${requestScope['org.apache.struts.action.EXCEPTION']}"/>
  	</c:catch>
  </c:if>
  <c:choose>
    <c:when test="${not empty message}"><h3 class="errorTitle">${message}</h3></c:when>
    <c:otherwise>
      <%
        StringWriter writer = new StringWriter();
        PrintWriter printWriter = new PrintWriter(writer);
        ((Throwable) request.getAttribute("org.apache.struts.action.EXCEPTION")).printStackTrace(printWriter);
      %>
      <c:set var="stackTrace" value="<%=writer.toString()%>"/>
      <pre id="stackTrace"><c:out value="${stackTrace}" escapeXml="true"/></pre>
    </c:otherwise>
  </c:choose>
  <div style="text-align: center;">
    <input type="button" class="button" value="<fmt:message key="button.back"/>" onclick="history.back(-1);"/>
  </div>
</c:if>
